﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SimpleFactory
{
    public class ClusteringFactory
    {
        // 静态工厂方法：根据类型创建聚类实例
        public static IClustering CreateClustering(string type)
        {
            IClustering clustering = null;
            switch (type.ToLower())
            {
                case "kmeans":
                    clustering = new KmeansClustering();
                    break;
                case "dbscan":
                    clustering = new DbscanClustering();
                    break;
                case "hierarchical":
                    clustering = new HierarchicalClustering();
                    break;
                default:
                    throw new ArgumentException("不支持的聚类算法类型：" + type);
            }
            return clustering;
        }
    }
}
